package com.linian.pushforcampus.mapper;

import com.linian.pushforcampus.domain.CampusActivity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * packageName com.linian.pushforcampus.mapper
 *
 * @author Lennon
 * @interfaceName CampusActivityMapper
 * @date 2023/11/10
 * @description TODO
 */

@Mapper
public interface CampusActivityMapper {

    @Select("select * from activity")
    List<CampusActivity> querryAllActivity();


    @Select("select * from activity where name like concat('%',#{name},'%')")
    List<CampusActivity> querryActivityByName(String name);

    @Insert("INSERT INTO activity ( publish_id,activity_id,subject_type,act_type,act_type_name,act_level,actLevel_name,sport_type,sport_type_name,departments_name,name,activity_apply_start_time,activity_apply_end_time,start_time,end_time,activity_place_detail,update_time,state)" + " VALUES ( #{publishId},#{activityId}, #{subjectType},#{actType}, #{actTypeName},#{actLevel}, #{actLevelName},#{sportType}, #{sportTypeName},#{departmentsName}, #{name}, #{activityApplyStartTime}, #{activityApplyEndTime},#{startTime}, #{endTime},#{activityPlaceDetail}, #{updateTime},#{state})")
    int insertActivity(CampusActivity campusActivity);


    @Delete("truncate table activity")
    int delectActivityAll();

}
